Skip to content

Flow: Prefer imported types from @babel/types over global BabelNode* types (#57752) - #57752

Open
robhogan wants to merge 1 commit into
mainfrom
export-D113574665
Open

Flow: Prefer imported types from @babel/types over global BabelNode* types (#57752)#57752
robhogan wants to merge 1 commit into
mainfrom
export-D113574665

Conversation

@robhogan

@robhogan robhogan commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary:

Rationale

Flow lib defs that declare global types (available anywhere, without an import) must be referenced in .flowconfig and can't be maintained incrementally. That's not too bad for very stable APIs and it's necessary for environment/runtime globals, but for 3P libraries it makes the lib defs much more difficult to maintain for little benefit (we have to import the runtime APIs anyway). Secondarily, it's a problem for generating TypeScript types, as TS doesn't declare any 3P library globally.

Babel is one of few cases where a library declares Flow globals - every one has an importable equivalent.

This diff

Replaces usages of Babel global types across xplat/js with their babel/types equivalents

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D113574665

@meta-codesync

meta-codesync Bot commented Jul 29, 2026

Copy link
Copy Markdown

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D113574665.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 29, 2026
…e*` types (#57752)

Summary:

## Rationale
Flow lib defs that declare global types (available anywhere, without an `import`) must be referenced in `.flowconfig` and can't be maintained incrementally.  That's not too bad for very stable APIs and it's necessary for environment/runtime globals, but for 3P libraries it makes the lib defs much more difficult to maintain for little benefit (we have to import the runtime APIs anyway). Secondarily, it's a problem for generating TypeScript types, as TS doesn't declare any 3P library globally. 

Babel is one of few cases where a library declares Flow globals - every one has an importable equivalent.

## This diff
Replaces usages of Babel global types across xplat/js with their `babel/types` equivalents

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D113574665
@meta-codesync meta-codesync Bot changed the title Flow: Prefer imported types from @babel/types over global BabelNode* types Flow: Prefer imported types from @babel/types over global BabelNode* types (#57752) Jul 29, 2026
@meta-codesync
meta-codesync Bot force-pushed the export-D113574665 branch from 6177523 to 06b2811 Compare July 29, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant